//
//  UIScrollView+RxDZN.swift
//  live
//
//  Created by melvyn on 2018/8/17.
//  Copyright © 2018 NEET. All rights reserved.
//

import Foundation
import RxSwift
import RxCocoa

extension Reactive where Base: UIScrollView {
    
    public var emptyDataSetDelegate: DelegateProxy<UIScrollView, DZNEmptyDataSetDelegate> {
        return RxDZNEmptyDataSetDelegateProxy.proxy(for: base)
    }
    
    public var didTapView: ControlEvent<(UIScrollView, UIView)> {
        let source = emptyDataSetDelegate.methodInvoked(#selector(DZNEmptyDataSetDelegate.emptyDataSet(_:didTap:)))
            .map {
                ($0[0] as! UIScrollView, $0[1] as! UIView)
        }
        return ControlEvent(events: source)
    }
    
    public var didTapButton: ControlEvent<(UIScrollView, UIButton)> {
        let source = emptyDataSetDelegate.methodInvoked(#selector(DZNEmptyDataSetDelegate.emptyDataSet(_:didTap:)))
            .map { ($0[0] as! UIScrollView, $0[1] as! UIButton) }
        
        return ControlEvent(events: source)
    }
}
